<!-- html  4 
  -->

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>

         let  name = "古天乐,渣渣辉,梁朝伟,渣渣辉";

        //length
        console.log("name ",name);
        console.log("name.length ",name.length);
        
        // indexOf  ,lastIndexOf
        console.log("name.indexOf(\"渣渣辉\")",name.indexOf("渣渣辉"));
        console.log("name.lastIndexOf(\"渣渣辉\")",name.lastIndexOf("渣渣辉"));
        

        //按照分隔符 拆分成数组
        console.log("name.split(",") ",name.split(","));


        let  str = "abcdefhijklmn";
        console.log("str ",str);
        //截取字符窜 substring(start ,end)
        console.log("str.substring(3) ",str.substring(3));
        console.log("str.substring(3,6) ",str.substring(3,6));
        console.log("str.substring(3,-2) ",str.substring(3,-2));

        //截取字符窜 substring(start ,len)
        console.log("str.substr(3) ",str.substr(3));
        console.log("str.substr(3,6) ",str.substr(3,6));
        
        //截取字符窜 substring(start ,len)
        console.log("str.slice(3) ",str.slice(3));
        console.log("str.slice(3,6) ",str.slice(3,6));
        console.log("str.slice(3,-2) ",str.slice(3,-2));



        let intro = "My Name is xxxxx"

        console.log("intro",intro);
        //返回新的字符串，原始字符串没有修改
        let newStr = intro.replace("xxxxx","jshand");
        console.log("intro.replace(\"xxxxx\",\"jshand\") ",newStr);
        console.log("intro",intro);


    </script>
</head>

<body>




</body>

</html>